# import sys
# file = sys.stdout
# file.write('Hello')#输出流输出
# print('World')#print打印输出

file = open('test.txt', 'r')
# print(file.read())
print(file.read(3))
# 不需要写close
with open('test.txt','r',encoding='utf-8') as file2:
    # print(file2.read())
    # print(file2.readline())
     list2 = file2.readline()
     # print(list2)

str = 'day day up'
# with open('test.txt','w',encoding='utf-8') as file3:#会覆盖掉之前写的东西
#     file3.write(str)

# list3 = ['hello11','world22']
# with open('test.txt','a',encoding='utf-8') as file4:# 追加，不会覆盖之前的内容
#     file4.writelines(list3)

file = open('test.txt','r')

print(file.read(1))
print(file.read(2))
# print(file.read(3))
# print(file.read(4))

print(file.tell())#tell()
print(file.seek(2,1))  #seek()读取字节数